/** Created by CUIJA on 05-19-2017.*/


FoodsService.$inject = ['$http'];
function FoodsService($http) {

  var fsc = this;
   
   function  foodlist(icnum,callback){
     console.log("icnum:  "+icnum);
     var request = {
                method: 'GET',
                url: '/m/food/getFoodByIcnum/'+icnum
            };

            return $http(request).then(function(res, status, headers) {
              console.log(res.data);
                callback(null, res.data);
            });
   }


   function  getFoodById(foodId,callback){
     var request = {
                method: 'GET',
                url: 'm/food/getFoodById/'+foodId
            };

            return $http(request).then(function(res, status, headers) {
               console.log(res.data);
                callback(null, res.data);
            });
   }
  
  function  deleteFood(foodid,callback){
     var request = {
                method: 'GET',
                url: '/m/food/deleteFood/'+foodid
            };
       return $http(request).then(function(res, status, headers) {
               console.log(res.data);
                callback(null, res.data);
            });

  }

  return {
   foodlist:foodlist,
   getFoodById:getFoodById,
   deleteFood:deleteFood
  };
}


module.exports = FoodsService;